package com.example.springbootdemo.scene.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.springbootdemo.entity.GeoPoint;
import com.example.springbootdemo.utils.GeometryUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.ParseException;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;

import lombok.Data;

/**
 *@author xuwangqi
 *@date 2021/5/24 15:58
 **/
/**
    * 景区
    */
@ApiModel(value="com-example-springbootdemo-scene-entity-Scene")
@Data
@TableName(value = "scene")
public class Scene {
    /**
     * 非自增id
     */
    @TableId(value = "id", type = IdType.INPUT)
    @ApiModelProperty(value="非自增id")
    private String id;

    /**
     * 名称
     */
    @TableField(value = "name")
    @ApiModelProperty(value="名称")
    private String name;

    /**
     * 级别，5A,4A
     */
    @TableField(value = "level")
    @ApiModelProperty(value="级别，5A,4A")
    private String level;

    /**
     * 标签，多个标签，隔开
     */
    @TableField(value = "tags")
    @ApiModelProperty(value="标签，多个标签，隔开")
    private String tags;

    /**
     * 地址
     */
    @TableField(value = "address")
    @ApiModelProperty(value="地址")
    private String address;

    /**
     * 区域位置，polygon类型
     */
    @TableField(value = "poi")
    @ApiModelProperty(value="矩形区域位置，LineString ")
    @JsonIgnore
    private Geometry poi;

    public void setPoi(Geometry poi) {
        this.poi = poi;
        this.poiList=GeometryUtil.geometryToList(poi);
    }



    @ApiModelProperty("两点矩形区域字符串前台拼接")
    @TableField(exist = false)
    private List<GeoPoint> poiList;

    public void setPoiList(List<GeoPoint> poiList) throws ParseException {
        this.poiList = poiList;
        this.poi=GeometryUtil.listToGeometry(poiList);
    }

    /**
     * 区域位置，polygon类型
     */
    @TableField(value = "polygon")
    @ApiModelProperty(value="区域位置，polygon类型")
    @JsonIgnore
    private Geometry polygon;

    public void setPolygon(Geometry polygon) {
        this.polygon = polygon;
        this.polygonList= GeometryUtil.geometryToList(polygon);
    }

    @ApiModelProperty("多边形区域 多点的集合，首尾点需一致")
    @TableField(exist = false)
    private List<GeoPoint> polygonList;

    public void setPolygonList(List<GeoPoint> polygonList) throws ParseException {
        this.polygonList = polygonList;
        this.polygon = GeometryUtil.listToGeometry(polygonList);
    }

    /**
     * 景区中心坐标 POINT类型
     */
    @TableField(value = "center")
    @ApiModelProperty(value="景区中心坐标 POINT类型")
    private Object center;

    /**
     * 景区logo
     */
    @TableField(value = "logo")
    @ApiModelProperty(value="景区logo")
    private String logo;

    /**
     * 景区背景图
     */
    @TableField(value = "bgd")
    @ApiModelProperty(value="景区背景图")
    private String bgd;

    /**
     * 景区手绘图
     */
    @TableField(value = "handmade")
    @ApiModelProperty(value="景区手绘图")
    private String handmade;

    /**
     * 景区所包含的景点的设施类型
     */
    @TableField(value = "types")
    @ApiModelProperty(value="景区所包含的景点的设施类型")
    private String types;

    /**
     * 所属主题列表
     */
    @TableField(value = "content_topic")
    @ApiModelProperty(value="所属主题列表")
    private String contentTopic;

    /**
     * 最大放大倍率
     */
    @TableField(value = "max")
    @ApiModelProperty(value="最大放大倍率")
    private Byte max;

    /**
     * 最小缩小倍率
     */
    @TableField(value = "min")
    @ApiModelProperty(value="最小缩小倍率")
    private Byte min;

    /**
     * 开放时间
     */
    @TableField(value = "open_time")
    @ApiModelProperty(value="开放时间")
    private String openTime;

    /**
     * 简介
     */
    @TableField(value = "intro")
    @ApiModelProperty(value="简介")
    private String intro;

    /**
     * 售票说明
     */
    @TableField(value = "ticket")
    @ApiModelProperty(value="售票说明")
    private String ticket;

    /**
     * 交通支持
     */
    @TableField(value = "traffic")
    @ApiModelProperty(value="交通支持")
    private String traffic;

    /**
     * 服务支持
     */
    @TableField(value = "service")
    @ApiModelProperty(value="服务支持")
    private String service;

    /**
     * 所属省份
     */
    @TableField(value = "province")
    @ApiModelProperty(value="所属省份")
    private String province;

    /**
     * 所属市
     */
    @TableField(value = "city")
    @ApiModelProperty(value="所属市")
    private String city;

    /**
     * 所属区
     */
    @TableField(value = "zone")
    @ApiModelProperty(value="所属区")
    private String zone;

    /**
     * 状态，1正常，0闭圆，-1异常
     */
    @TableField(value = "status")
    @ApiModelProperty(value="状态，1正常，0闭圆，-1异常")
    private Byte status;

    /**
     * 是否删除，1被删除
     */
    @TableField(value = "is_delete")
    @ApiModelProperty(value="是否删除，1被删除")
    private Byte isDelete;

    @TableField(value = "gmt_create")
    @ApiModelProperty(value="")
    private Date gmtCreate;

    @TableField(value = "gmt_modified")
    @ApiModelProperty(value="")
    private Date gmtModified;

    /**
     * 矩形区域位置，polygon类型
     */
    @TableField(value = "rectangle")
    @ApiModelProperty(value="矩形区域位置，polygon类型")
    private Object rectangle;

    public static final String COL_ID = "id";

    public static final String COL_NAME = "name";

    public static final String COL_LEVEL = "level";

    public static final String COL_TAGS = "tags";

    public static final String COL_ADDRESS = "address";

    public static final String COL_POI = "poi";

    public static final String COL_POLYGON = "polygon";

    public static final String COL_CENTER = "center";

    public static final String COL_LOGO = "logo";

    public static final String COL_BGD = "bgd";

    public static final String COL_HANDMADE = "handmade";

    public static final String COL_TYPES = "types";

    public static final String COL_CONTENT_TOPIC = "content_topic";

    public static final String COL_MAX = "max";

    public static final String COL_MIN = "min";

    public static final String COL_OPEN_TIME = "open_time";

    public static final String COL_INTRO = "intro";

    public static final String COL_TICKET = "ticket";

    public static final String COL_TRAFFIC = "traffic";

    public static final String COL_SERVICE = "service";

    public static final String COL_PROVINCE = "province";

    public static final String COL_CITY = "city";

    public static final String COL_ZONE = "zone";

    public static final String COL_STATUS = "status";

    public static final String COL_IS_DELETE = "is_delete";

    public static final String COL_GMT_CREATE = "gmt_create";

    public static final String COL_GMT_MODIFIED = "gmt_modified";

    public static final String COL_RECTANGLE = "rectangle";
}